package com.example.androidtraining_ahut2020;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;

import androidx.appcompat.app.AppCompatActivity;

public class MainActivity extends AppCompatActivity {
    Button btnExp08;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        final Button btn = (Button) super.findViewById(R.id.button);
        btn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Toast.makeText(MainActivity.this, "Hello Android", Toast.LENGTH_LONG)
                        .show();
            }
        });
        btnExp08 = super.findViewById(R.id.exp08);
        btnExp08.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(MainActivity.this, MainActivityDay08ShowTime.class);
                //数据打包
                Bundle bundle = new Bundle();
                bundle.putString("school", "ahut");
                bundle.putInt("year", 2020);
                intent.putExtras(bundle);
                startActivity(intent);
            }
        });
        findViewById(R.id.exp09IntentDemo).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(MainActivity.this, MainActivityDay09IntentDemo1.class);
                startActivity(intent);
            }
        });
        findViewById(R.id.btnExp09SimpleCalculator).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(MainActivity.this, MainActivityDay09Calculator.class);
                startActivity(intent);
            }
        });
        findViewById(R.id.btnExp09LoginFrame).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(MainActivity.this, MainActivityDay09Login.class);
                startActivity(intent);
            }
        });
    }

    public void clickExp10a(View v) {
        Intent intent = new Intent(MainActivity.this, MainActivityDay10ListViewApp.class);
        startActivity(intent);
    }

    public void clickExp10b(View v) {
        Intent intent = new Intent(MainActivity.this, MainActivityDay10Calculator.class);
        startActivity(intent);
    }

    public void clickExp10(View v) {
        Intent intent = new Intent(MainActivity.this, MainActivityDay10DynamicLayout.class);
        startActivity(intent);
    }

    public void clickExp11a(View v) {
        Intent intent = new Intent(MainActivity.this, MainActivityDay11SharedPreference.class);
        startActivity(intent);
    }

    public void clickExp11b(View v) {
        Intent intent = new Intent(MainActivity.this, MainActivityDay11SQLiteDemo.class);
        startActivity(intent);
    }

    public void clickPoint24(View v) {
        Intent intent = new Intent(MainActivity.this, MainActivityProject.class);
        startActivity(intent);
    }
}
